﻿import com.dmotiko.zonaoutlet.*
import com.dmotiko.general.*
import com.dmotiko.lib.*
import mx.utils.Delegate;

class ZOPromocionesList
extends BaseClip {
	
	private var mcMask:MovieClip;
	private var mcBar:MovieClip;
	private var mcDragger:MovieClip;
	private var mcContent:MovieClip;
	
	public function ZOPromocionesList() {
		mcMask._visible = false;
		mcDragger._visible = false;
		mcBar._visible = false;
	}
	
	private function initClip():Void {
		
		mcContent = this.createEmptyMovieClip("mcContent", this.getNextHighestDepth() );
		var aPromos:Array = ZOSite.getApp().getPromosData();
		var aOutlets:Array = ZOSite.getApp().getOutletsData();
		var nY:Number = 0;
		for (var i:Number = 0; i < aPromos.length; i++) {
			var oData:Object = aPromos[i];
			for(var i2:Number = 0; i2 < aOutlets.length; i2++) {
				if ( aOutlets[i2].ID == oData.outletID ) {
					oData.outlet = aOutlets[i2];
					break;
				}
			}
			var clip:ZOPromocionItem = ZOPromocionItem( mcContent.attachMovie( "ZOPromocionItem", "promo" + i, mcContent.getNextHighestDepth() ) );
			clip.setData( oData );
			clip._y = nY;
			nY += clip._height + 40;
		}
		if ( mcContent._height > mcMask._height) {
			ScrollerMovie.setScroll( mcContent, mcMask, mcDragger, mcBar );
		}
	}
	
	private function refreshData() {
		
	}
	
}